deferred class IUP_CONTAINER

inherit
	IUP_WIDGET
	IUP_WIDGET_VISIBLE
			
feature {ANY}

	-- Commands to handle heirarchy
	
	append (new_child: IUP_WIDGET): IUP_WIDGET
		-- Inserts an interface element at the end of the container, after 
		-- the last element of the container. Valid for any element that
		-- contains other elements like dialog, frame, hbox, vbox, zbox or menu.
		-- Returns: the actual parent if the interface element was 
		-- successfully inserted. Otherwise returns Void.
		do
			Result := iup_open.iup_append(Current, new_child)
		end

   insert (ref_child: IUP_WIDGET; new_child: IUP_WIDGET): IUP_WIDGET
		-- Inserts an interface element before another child of the 
		-- container. Valid for any element that contains other elements 
		-- like dialog, frame, hbox, vbox, zbox, menu, etc.
		-- Returns: the actual parent if the interface element was 
		-- successfully inserted. Otherwise returns NULL
		do
			Result := iup_open.iup_insert(Current, ref_child, new_child)
		end

	get_child (pos: INTEGER): IUP_WIDGET
		-- Returns the a child of the control given its position.
		-- Returns: the child or Void if there is none.
		do
			Result := iup_open.iup_get_child(Current, pos)
		end

	get_child_pos (child: IUP_WIDGET): INTEGER
		-- Returns the position of a child of the given control.
		-- Returns: the position of the desire child starting at 0, or -1 
		-- if child not found.
		do
			Result := iup_open.iup_get_child_pos(Current, child)
		end

	get_child_count: INTEGER
		-- Returns the number of children of the given control.
		do
			Result := iup_open.iup_get_child_count(Current)
		end

	get_next_child (child: IUP_WIDGET): IUP_WIDGET
		-- Returns the a child of the given control given its brother.
		-- Returns: the child or Void.
		do
			Result := iup_open.iup_get_next_child(Current, child)
		end

	refresh_children
		-- Updates the size and layout of controls after changing size 
		-- attributes, or attributes that affect the size of the control. Can 
		-- be used for any element inside a dialog, only its children will 
		-- be	updated. It can change the layout of all the controls inside 
		-- the given element because of the dynamic layout positioning. 
		do
			iup_open.iup_refresh_children(Current)
		end

	update_children
		-- Mark the element children to be redraw when the control returns 
		-- to	the system.
		do
			iup_open.iup_update_children(Current)
		end

	redraw_with_children
		-- Force the element and its children to be redrawn immediately.
		do
			iup_open.iup_redraw(Current, 1)
		end
	
end

-- The MIT License (MIT)

-- Copyright (c) 2016, 2018 by German A. Arias

-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in 
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
